<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style>
        * {
        padding: 0px;
        margin: 0px;
        }

        body {
        width:100%;
        font-family: fantasy;
        font-size: 13px;
        }

        h1 {
        text-align: center;
        }

        #myDiv{
        margin-top:50px;
        width:100%;
        text-align: center;
        }

        table
        {
            margin-left: auto;
            margin-right: auto;
        }

    </style>
    <script src="/js/jquery-1.8.0.min.js"></script>
</head>
<body>

<h1>Add Uid</h1>

<div id="myDiv">
    <table cellspacing="10" cellpadding="0" width="400" >
            <tr align=left>
                <td width="100" align=right>uid&nbsp&nbsp&nbsp :</td>
                <td width="300" colspan="3"><input id="uid" name="uid" type="text"></td>
            </tr>

            <tr align=left>
                <td width="100" align=right>pushId&nbsp&nbsp&nbsp :</td>
                <td width="300" colspan="3"><input id="pushId" name="pushId" type="text"></td>
            </tr>

            <tr align=right>
                <td  width="400" colspan=4 align="center"><input type="button" onclick="ajaxAdd()" value="Add"/></td>
            </tr>
            <tr></tr>
            <tr>
                <td width="400" colspan="4" align="center"><font size="5" color="green" id="result"></font></td>
            </tr>

    </table>
</div>
<script>
         function ajaxAdd(){
            var uid =$("#uid").val();
            if(uid == "")
            {
                alert("uid 不能为空");
                return false;
            }
            var pushId = $("#pushId").val();
            if(pushId == "")
            {
                alert("pushId 不能为空");
                return false
            }
            $.ajax({
                type: 'GET',
                url: '/api/addPushIdToUid',
                data:{
                    pushId: pushId,
                    uid: uid
                },
                success: function (data) {
                    document.getElementById("result").innerHTML = JSON.stringify(data);
                },
                error: function(data){
                    document.getElementById("result").innerHTML = JSON.stringify(data);
                }
           });
        }
</script>

</body>
</html>